package pl.edu.agh.podyplomowe;

import java.util.ArrayList;
import java.util.List;

public class TripsManager {
	
	List<Trip> trips = new ArrayList<Trip>();
	
	public void addTrip(Trip trip) {
		trips.add(trip);
	}
	
	public List<Trip> getTrips() {
		return trips;
	}

	public List<Trip> findTrips(String keyword){
		List<Trip> foundedTrips = new ArrayList<Trip>();  
		for(Trip trip : trips){
			if(trip.getName().contains(keyword)) {
				foundedTrips.add(trip);				
			}
		}
		return foundedTrips;
	}
	
	public void remove(String name){
		for(Trip trip : trips){
			if(trip.getName() == name) {
				trips.remove(trip);
				return;
			}
		}		
	}
	
}
